


#ifndef PF_DIALOGFACTORYINTERFACE_H
#define PF_DIALOGFACTORYINTERFACE_H

#include "lx_define.h"
#include "lx_String.h"
#include "lx_Export.h"

class PF_ActionInterface;
class PF_ArcAttribute;
class PF_AttributesData;
class PF_BevelAttribute;
class PF_Block;
class PF_BlockAttribute;
class PF_BlockList;
class PF_CircleAttribute;
class PF_DimLinearAttribute;
class PF_DimensionAttribute;
class PF_Document;
class PF_Entity;
class PF_EventHandler;
class PF_Graphic;
class PF_GraphicView;
class PF_Grid;
class PF_Hatch;
class PF_Insert;
class PF_Layer;
class PF_LayerList;
class PF_MirrorAttribute;
class PF_MoveAttribute;
class PF_MoveRotateAttribute;
class PF_Painter;
class PF_Rotate2Attribute;
class PF_RotateAttribute;
class PF_RoundAttribute;
class PF_ScaleAttribute;
class PF_Solid;
class PF_Text;
class PF_Vector;

/**
 * Interface for objects that can create and show dialogs.
 */
class LX_EXPORT PF_DialogFactoryInterface {
public:
    PF_DialogFactoryInterface() {}
    ;
    virtual ~PF_DialogFactoryInterface() {}
    ;

    /**
     * This virtual method must be overwritten and must show the previously
     * shown menu in the cad toolbar.
     */
    virtual void requestPreviousMenu() = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a message dialog.
     */
    virtual void requestWarningDialog(const PF_String& warning) = 0;

	/**
	 * This virtual method must be overwritten and must create a new
	 * window for the given document or for a new document isf no document
	 * is given.
	 */
    virtual PF_GraphicView* requestNewDocument(const PF_String& fileName = PF_String::null, 
			PF_Document* doc=NULL) = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a dialog for choosing the properties of a new layer to be 
     * created. The method must create the new layer but not add 
     * it to the layer list. The latter is up to the caller.
     *
     * @return The implementation is expected to return a pointer 
     *         to the newly created layer or NULL if the user 
     *         cancels the dialog.
     */
    virtual PF_Layer* requestNewLayerDialog(
        PF_LayerList* layerList = NULL) = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a dialog that asks for permission for removing the selected
     * layer from the layer list. The method must not actually
     * remove the layer. This is up to the caller.
     *
     * @return The implementation is expected to return a pointer
     *         to the layer which can ne removed or NULL if the user
     *         cancels the dialog.
     */
    virtual PF_Layer* requestLayerRemovalDialog(
        PF_LayerList* layerList = NULL) = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a dialog to edit the layers attributes. The method must
     * not actually edit the layer. This is up to the caller.
     *
     * @return The implementation is expected to return a pointer 
     *         to the modified layer or NULL if the user 
     *         cancels the dialog.
     */
    virtual PF_Layer* requestEditLayerDialog(
        PF_LayerList* layerList = NULL) = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a dialog for choosing the properties of a new block to be 
     * created. The method must create the new block but not add 
     * it to the block list. The latter is up to the caller.
    *
    * @param block Pointer to the newly created block with default
    *              attributes.
     *
     * @return The implementation is expected to return a pointer 
     *         to the newly created block or NULL if the user 
     *         cancels the dialog.
     */
    virtual PF_BlockAttribute requestNewBlockDialog(PF_BlockList* blockList) = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a dialog that asks for permission for removing the selected 
     * block from the block list. The method must not actually 
     * remove the block. This is up to the caller.
     *
     * @return The implementation is expected to return a pointer 
     *         to the block which can be removed or NULL if the user 
     *         cancels the dialog.
     */
    virtual PF_Block* requestBlockRemovalDialog(
        PF_BlockList* blockList) = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a dialog that allows to change blocks attributes of the  
     * currently active block. 
     *
     * @return The implementation is expected to return a pointer 
     *         to the block which was changed or NULL if the user 
     *         cancels the dialog.
     */
    virtual PF_BlockAttribute requestBlockAttributesDialog(
        PF_BlockList* blockList) = 0;

    /**
     * This virtual method must be overwritten and should provide
     * a way to edit a block. 
     */
    virtual void requestEditBlockWindow(
        PF_BlockList* blockList) = 0;

	virtual void closeEditBlockWindow(PF_Block* block) = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a dialog to get a filename for saving a file. The method must
     * not actually save the file. This is up to the caller.
     *
     * @return The implementation is expected to return a string
     *         which contains the file name or an empty string if
     *         the user cancels the dialog.
     */
    //virtual PF_String requestFileSaveAsDialog() = 0;

    /**
     * This virtual method must be overwritten and must provide
     * a dialog to get a filename for opening a file. The method must
     * not actually open the file. This is up to the caller.
     *
     * @return The implementation is expected to return a string
     *         which contains the file name or an empty string if
     *         the user cancels the dialog.
     */
    //virtual PF_String requestFileOpenDialog() = 0;
	
    /**
     * This virtual method must be overwritten and must provide
     * a dialog to get a filename for opening an image file. The method must
     * not actually open the file. This is up to the caller.
     *
     * @return The implementation is expected to return a string
     *         which contains the file name or an empty string if
     *         the user cancels the dialog.
     */
    virtual PF_String requestImageOpenDialog() = 0;
	
    /**
     * This virtual method must be overwritten and must present
     * a widget for options for the given action.
     *
	 * @param action Pointer to the action which needs the options.
     * @param on true: switch widget on, false: off
	 * @param update true: widget gets data from the action, false: 
	 *   widget gets data from config file.
     */
    virtual void requestOptions(PF_ActionInterface* action, 
		bool on, bool update = false) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a widget for snap point with distance options.
     *
     * @param dist Distance which can be directly changed 
     *             by the presented widget.
     * @param on true: switch widget on, false: off
     */
    virtual void requestSnapDistOptions(double& dist, bool on) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a widget for entity attributes.
     *
     * @param data Attribute data which can be directly changed 
     *             by the presented widget.
     */
    virtual bool requestAttributesDialog(PF_AttributesData& data,
		PF_LayerList& layerList) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a widget for move options (number of copies).
     *
     * @param data Move data which can be directly changed 
     *             by the presented widget.
     */
    virtual bool requestMoveDialog(PF_MoveAttribute& data) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a widget for rotate options (number of copies, angle).
     *
     * @param data Rotation data which can be directly changed 
     *             by the presented widget.
     */
    virtual bool requestRotateDialog(PF_RotateAttribute& data) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a widget for rotate options (number of copies, angle).
     *
     * @param data Scaling data which can be directly changed 
     *             by the presented widget.
     */
    virtual bool requestScaleDialog(PF_ScaleAttribute& data) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a widget for mirror options (number of copies).
     *
     * @param data Mirror data which can be directly changed 
     *             by the presented widget.
     */
    virtual bool requestMirrorDialog(PF_MirrorAttribute& data) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a widget for move/rotate options (number of copies, angle).
     *
     * @param data Move/rotate data which can be directly changed 
     *             by the presented widget.
     */
    virtual bool requestMoveRotateDialog(PF_MoveRotateAttribute& data) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a widget for rotate around two centers options (number of 
    * copies, angles).
     *
     * @param data Rotate data which can be directly changed 
     *             by the presented widget.
     */
    virtual bool requestRotate2Dialog(PF_Rotate2Attribute& data) = 0;

    /**
     * This virtual method must be overwritten and must show
     * the given toolbar.
     *
     * @param id Tool bar ID.
     */
    virtual void requestToolBar(LX_Define::ToolBarId id) = 0;

    /**
     * This virtual method must be overwritten and must show
     * the tag toolbar with a button for launching the given
     * action.
     *
     * @param nextAction ID of next action to create after selecting was done.
     */
    virtual void requestToolBarSelect(PF_ActionInterface* selectAction,
                                      LX_Define::ActionType nextAction) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a dialog to edit the given entity.
     *
     * @param entity Pointer to the entity.
     */
    virtual bool requestModifyEntityDialog(PF_Entity* entity) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a dialog to edit text entity attributes.
     *
     * @param entity Pointer to the text entity.
     */
    virtual bool requestTextDialog(PF_Text* text) = 0;

    /**
     * This virtual method must be overwritten and must present
     * a dialog to select pattern attributes.
     *
     * @param entity Pointer to the hatch entity.
     */
    virtual bool requestHatchDialog(PF_Hatch* hatch) = 0;
	
    /**
     * This virtual method must be overwritten and must present
     * a dialog for general application options.
     */
    virtual void requestOptionsGeneralDialog() = 0;
	
    /**
     * This virtual method must be overwritten and must present
     * a dialog for drawing options.
	 *
	 * @param graphic Graphic document.
     */
    virtual void requestOptionsDrawingDialog(PF_Graphic& graphic) = 0;
	

    /**
     * This virtual method must be overwritten if the graphic view has
     * a component that is interested in the current mouse position.
     * The implementation will be called every time the mouse position
     * changes.
     *
     * @param abs Absolute coordiante of the mouse cursor or the 
     *            point it snaps to.
     * @param rel Relative coordiante.
     */
    virtual void updateCoordinateWidget(const PF_Vector& abs,
										const PF_Vector& rel,
										bool updateFormat=false) = 0;

    /**
     * This virtual method must be overwritten if the graphic view has
     * a component that is interested in the current mouse button hints.
     * The implementation will be called typically by actions to inform
     * the user about the current functionalty of the mouse buttons.
     *
     * @param left Help text for the left mouse button.
     * @param right Help text for the right mouse button.
     */
    virtual void updateMouseWidget(const PF_String& left,
                                   const PF_String& right) = 0;
								   
    /**
     * This virtual method must be overwritten if the graphic view has
     * a component that is interested in the current number of selected
	 * entities.
     * The implementation will be called every time the selection
     * changes.
     *
     * @param num Number of selected entities
     */
    virtual void updateSelectionWidget(int num) = 0;

    /**
     * This virtual method must be overwritten if the graphic view has
     * a component that is interested in command messages (such as a 
    * command line history).
     * The implementation will be called typically by actions to inform
     * the user about current events and errors.
     *
     * @param message The message for the user.
     */
    virtual void commandMessage(const PF_String& message) = 0;


	virtual bool isAdapter() = 0;
};

#endif
